﻿using CookComputing.XmlRpc;
using PerceptiveMCAPI.Types;
using PerceptiveMCAPI.Types.Internal;
//
namespace PerceptiveMCAPI
{
   [XmlRpcUrl( "http://api.mailchimp.com/1.2/" )]
   public interface IMC : IXmlRpcProxy
   {
      #region ==================================================================== "Campaign Related"

      [XmlRpcMethod( "campaignContent" )]
      x_campaignContent campaignContent( string apikey, string cid, bool for_archive );
      //
      [XmlRpcMethod( "campaignCreate" )]
      string campaignCreate( string apikey, string type, XmlRpcStruct options, XmlRpcStruct content, XmlRpcStruct segment_opts, XmlRpcStruct type_opts );
      //
      [XmlRpcMethod( "campaignDelete" )]
      bool campaignDelete( string apikey, string cid );
      //
      [XmlRpcMethod( "campaignEcommAddOrder" )]
      bool campaignEcommAddOrder( string apikey, XmlRpcStruct order );
      //
      [XmlRpcMethod( "campaignFolders" )]
      x_campaignFolders[] campaignFolders( string apikey );
      //
      [XmlRpcMethod( "campaignPause" )]
      bool campaignPause( string apikey, string cid );
      //
      [XmlRpcMethod( "campaignReplicate" )]
      string campaignReplicate( string apikey, string cid );
      //
      [XmlRpcMethod( "campaignResume" )]
      bool campaignResume( string apikey, string cid );
      //
      [XmlRpcMethod( "campaignSchedule" )]
      bool campaignSchedule( string apikey, string cid, string schedule_time, string schedule_time_b );
      //
      [XmlRpcMethod( "campaignSegmentTest" )]
      int campaignSegmentTest( string apikey, string list_id, XmlRpcStruct options );
      //
      [XmlRpcMethod( "campaignSendNow" )]
      bool campaignSendNow( string apikey, string cid );
      //
      // send_type as string.empty doesn't send anything, and null gives exception -- 2 signatures needed
      [XmlRpcMethod( "campaignSendTest" )]
      bool campaignSendTest( string apikey, string cid, string[] test_emails );
      [XmlRpcMethod( "campaignSendTest" )]
      bool campaignSendTest( string apikey, string cid, string[] test_emails, string send_type );
      //
      [XmlRpcMethod( "campaignShareReport" )]   /* New with MC v1.2.3 */
      x_campaignShareReport campaignShareReport( string apikey, string cid, XmlRpcStruct opts );

      [XmlRpcMethod( "campaignTemplates" )]
      x_campaignTemplates[] campaignTemplates( string apikey );
      //
      [XmlRpcMethod( "campaignUnschedule" )]
      bool campaignUnschedule( string apikey, string cid );
      //
      // ------------------------------------------------------------------------- campaignUpdate variations 
      [XmlRpcMethod( "campaignUpdate" )]
      bool campaignUpdate( string apikey, string cid, string name, string valString );
      //
      [XmlRpcMethod( "campaignUpdate" )]
      bool campaignUpdate( string apikey, string cid, string name, int valInt );
      //
      [XmlRpcMethod( "campaignUpdate" )]
      bool campaignUpdate( string apikey, string cid, string name, bool valBool );
      //
      [XmlRpcMethod( "campaignUpdate" )]
      bool campaignUpdate( string apikey, string cid, string name, campaignTracking tracking );
      //
      [XmlRpcMethod( "campaignUpdate" )]
      bool campaignUpdate( string apikey, string cid, string name, XmlRpcStruct valRpcStruct );
      // --------------------------------
      [XmlRpcMethod( "campaigns" )]
      x_campaigns[] campaigns( string apikey, XmlRpcStruct filters, int start, int limit );

      #endregion

      #region --------------------------------------------------------------- "Campaign Stats"

      [XmlRpcMethod( "campaignAbuseReports" )]
      x_campaignAbuseReports[] campaignAbuseReports( string apikey, string cid, string since, int start, int limit );

      [XmlRpcMethod( "campaignAdvice" )]  /* New with v1.2 */
      x_campaignAdvice[] campaignAdvice( string apikey, string cid );

      [XmlRpcMethod( "campaignAnalytics" )]  /* New with v1.2 */
      x_campaignAnalytics campaignAnalytics( string apikey, string cid );

      [XmlRpcMethod( "campaignBounceMessages" )]   /* New with v1.2 */
      x_campaignBounceMessages[] campaignBounceMessages( string apikey, string cid, int start, int limit, string since );

      [XmlRpcMethod( "campaignClickStats" )]
      object campaignClickStats( string apikey, string cid );

      [XmlRpcMethod( "campaignEcommOrders" )]   /* New with v1.2 */
      x_campaignEcommOrders[] campaignEcommOrders( string apikey, string cid, int start, int limit, string since );

      [XmlRpcMethod( "campaignEepUrlStats" )]  /* campaignEepUrlStats [MC v1.2.5] */
      object campaignEepUrlStats( string apikey, string cid );

      [XmlRpcMethod( "campaignEmailDomainPerformance" )] /* New with v1.2 */
      x_campaignEmailDomainPerformance[] campaignEmailDomainPerformance( string apikey, string cid );

      [XmlRpcMethod( "campaignGeoOpens" )]  /* campaignEepUrlStats [MC v1.2.5] */
      x_campaignGeoOpens[] campaignGeoOpens( string apikey, string cid );

      [XmlRpcMethod( "campaignGeoOpensForCountry" )]  /* campaignGeoOpensForCountry [MC v1.2.5] */
      x_campaignGeoOpensForCountry[] campaignGeoOpensForCountry( string apikey, string cid, string code );

      [XmlRpcMethod( "campaignHardBounces" )]
      string[] campaignHardBounces( string apikey, string cid, int start, int limit );

      [XmlRpcMethod( "campaignSoftBounces" )]
      string[] campaignSoftBounces( string apikey, string cid, int start, int limit );

      [XmlRpcMethod( "campaignStats" )]
      x_campaignStats campaignStats( string apikey, string cid );

      [XmlRpcMethod( "campaignUnsubscribes" )]
      string[] campaignUnsubscribes( string apikey, string cid, int start, int limit );

      #endregion

      #region --------------------------------------------------------------- "Campaign AIM Reports"

      [XmlRpcMethod( "campaignClickDetailAIM" )]
      x_campaignClickDetailAIM[] campaignClickDetailAIM( string apikey, string cid, string url, int start, int limit );

      [XmlRpcMethod( "campaignEmailStatsAIM" )]
      x_campaignEmailStatsAIM[] campaignEmailStatsAIM( string apikey, string cid, string email_address );

      [XmlRpcMethod( "campaignEmailStatsAIMAll" )]
      XmlRpcStruct campaignEmailStatsAIMAll( string apikey, string cid, int start, int limit );

      [XmlRpcMethod( "campaignNotOpenedAIM" )]
      string[] campaignNotOpenedAIM( string apikey, string cid, int start, int limit );

      [XmlRpcMethod( "campaignOpenedAIM" )]
      x_campaignOpenedAIM[] campaignOpenedAIM( string apikey, string cid, int start, int limit );

      #endregion

      #region ==================================================================== "Lists"

      [XmlRpcMethod( "listAbuseReports" )]   /* New with v1.2 */
      x_listAbuseReport[] listAbuseReports( string apikey, string id, int start, int limit, string since );
      //
      [XmlRpcMethod( "listBatchSubscribe" )]  // DummyMCBatchResult
      x_listBatchSubscribe listBatchSubscribe( string apikey, string id, XmlRpcStruct batch, bool double_optin, bool update_existing, bool replace_interests );
      //
      [XmlRpcMethod( "listBatchUnsubscribe" )]  // DummyMCBatchResult, batch was 'emails' in doc.
      x_listBatchUnsubscribe listBatchUnsubscribe( string apikey, string id, XmlRpcStruct batch, bool delete_member, bool send_goodbye, bool send_notify );
      //
      [XmlRpcMethod( "listGrowthHistory" )]  /* New with v1.2 */
      x_listGrowthHistory[] listGrowthHistory( string apikey, string id );
      //
      [XmlRpcMethod( "listInterestGroupAdd" )]
      bool listInterestGroupAdd( string apikey, string id, string group_name );
      [XmlRpcMethod( "listInterestGroupAdd" )]
      bool listInterestGroupAdd( string apikey, string id, string group_name, int grouping_id );
      //
      [XmlRpcMethod( "listInterestGroupDel" )]
      bool listInterestGroupDel( string apikey, string id, string group_name );
      [XmlRpcMethod( "listInterestGroupDel" )]
      bool listInterestGroupDel( string apikey, string id, string group_name, int grouping_id );
      //
      [XmlRpcMethod( "listInterestGroupUpdate" )]     // v1.2.2
      bool listInterestGroupUpdate( string apikey, string id, string old_name, string new_name );
      [XmlRpcMethod( "listInterestGroupUpdate" )]     // v1.2.2
      bool listInterestGroupUpdate( string apikey, string id, string old_name, string new_name, int grouping_id );
      //
      [XmlRpcMethod( "listInterestGroups" )]    // DEPRECATED
      x_listInterestGroups listInterestGroups( string apikey, string id );
      //
      [XmlRpcMethod( "listInterestGroupingAdd" )]              // -- v1.2.6
      int listInterestGroupingAdd( string apikey, string id, string name, string type_name, string[] groups );
      //
      [XmlRpcMethod( "listInterestGroupingDel" )]              // -- v1.2.6
      bool listInterestGroupingDel( string apikey, int grouping_id );
      //
      [XmlRpcMethod( "listInterestGroupingUpdate" )]           // -- v1.2.6
      bool listInterestGroupingUpdate( string apikey, int grouping_id, string name, string value );
      //
      [XmlRpcMethod( "listInterestGroupings" )]                // -- v1.2.6
      x_listInterestGroupings[] listInterestGroupings( string apikey, string id );
      //
      [XmlRpcMethod( "listMemberInfo" )]
      x_listMemberInfo listMemberInfo( string apikey, string id, string email_address );
      //
      [XmlRpcMethod( "listMembers" )]
      x_listMember[] listMembers( string apikey, string id, string status, string since, int start, int limit );
      //
      [XmlRpcMethod( "listMergeVarAdd" )] // -- new signature in v1.2 (req => options)
      bool listMergeVarAdd( string apikey, string id, string tag, string name, XmlRpcStruct options );
      //
      [XmlRpcMethod( "listMergeVarDel" )]
      bool listMergeVarDel( string apikey, string id, string tag );
      //
      [XmlRpcMethod( "listMergeVarUpdate" )] // --  v1.2.2 added (why not name??)
      bool listMergeVarUpdate( string apikey, string id, string tag, XmlRpcStruct options );
      //
      [XmlRpcMethod( "listMergeVars" )]
      x_listMergeVars[] listMergeVars( string apikey, string id );
      // 
      [XmlRpcMethod( "listSubscribe" )]
      bool listSubscribe( string apikey, string id, string email_address, XmlRpcStruct merge_vars, string email_type, bool double_optin, bool update_existing, bool replace_interests, bool send_welcome );
      //
      [XmlRpcMethod( "listUnsubscribe" )]
      bool listUnsubscribe( string apikey, string id, string email_address, bool delete_member, bool send_goodbye, bool send_notify );
      //
      [XmlRpcMethod( "listUpdateMember" )]
      bool listUpdateMember( string apikey, string id, string email_address, XmlRpcStruct merge_vars, string email_type, bool replace_interests );
      //
      [XmlRpcMethod( "listWebhookAdd" )]
      bool listWebhookAdd( string apikey, string id, string url, XmlRpcStruct actions, XmlRpcStruct sources );
      //
      [XmlRpcMethod( "listWebhookDel" )]
      bool listWebhookDel( string apikey, string id, string url );
      //
      [XmlRpcMethod( "listWebhooks" )]
      x_listWebhook[] listWebhooks( string apikey, string id );
      //      
      [XmlRpcMethod( "lists" )]
      x_list[] lists( string apikey );

      // --------------------------------------------------- static segments, all in MC v1.2.7
      [XmlRpcMethod( "listAddStaticSegment" )]
      int listAddStaticSegment( string apikey, string id, string name );
      // 
      [XmlRpcMethod( "listDelStaticSegment" )]
      bool listDelStaticSegment( string apikey, string id, int seg_id );
      //
      [XmlRpcMethod( "listResetStaticSegment" )]
      bool listResetStaticSegment( string apikey, string id, int seg_id );
      //
      [XmlRpcMethod( "listStaticSegmentAddMembers" )]
      x_listStaticSegmentAddMembers listStaticSegmentAddMembers( string apikey, string id, int seg_id, string[] batch );
      //
      [XmlRpcMethod( "listStaticSegmentDelMembers" )]
      x_listStaticSegmentDelMembers listStaticSegmentDelMembers( string apikey, string id, int seg_id, string[] batch );
      // 
      [XmlRpcMethod( "listStaticSegments" )]
      x_listStaticSegments[] listStaticSegments( string apikey, string id );

      #endregion

      #region ================================================= "Helper"

      // --------------------------------------------------- chimpChatter [MC v1.2.5]
      [XmlRpcMethod( "chimpChatter" )]
      x_chimpChatter[] chimpChatter( string apikey );
      //
      [XmlRpcMethod( "createFolder" )]
      int createFolder( string apikey, string name );
      // --------------------------------------------------- ecommAddOrder [MC v1.2.5]
      [XmlRpcMethod( "ecommAddOrder" )]
      bool ecommAddOrder( string apikey, XmlRpcStruct order );
      // ------------------------------------------------------------ content 'mixed'
      [XmlRpcMethod( "generateText" )]
      string generateText( string apikey, string type, string content );
      [XmlRpcMethod( "generateText" )]
      string generateText( string apikey, string type, XmlRpcStruct content );
      // --------------------------------------------------- getAccountDetails new in MC v1.2.2
      [XmlRpcMethod( "getAccountDetails" )]
      x_getAccountDetails getAccountDetails( string apikey );
      //
      // --------------------------------------------------- getAffiliateInfo deprecated in MC v1.2.2, PerceptiveMCAPI v1.2.4
      //[XmlRpcMethod( "getAffiliateInfo" )]
      //x_getAffiliateInfo getAffiliateInfo( string apikey );
      //
      [XmlRpcMethod( "inlineCss" )]
      string inlineCss( string apikey, string html, bool strip_css );
      // --------------------------------------------------- listsForEmail [MC v1.2.5]
      [XmlRpcMethod( "listsForEmail" )]
      string[] listsForEmail( string apikey, string email_address );
      //
      [XmlRpcMethod( "ping" )]
      string ping( string apikey );

      #endregion

      #region ================================================= "Security"

      [XmlRpcMethod( "apikeyAdd" )]
      string apikeyAdd( string username, string password, string apikey );
      [XmlRpcMethod( "apikeyExpire" )]
      bool apikeyExpire( string username, string password, string apikey );
      [XmlRpcMethod( "apikeys" )]
      x_apikeys[] apikeys( string username, string password, string apikey, bool expired );  // MCApiKey[]
      //
      // ------------------------------------------------------------ deprecated in MC v1.2.2, PerceptiveMCAPI v1.2.4
      //[XmlRpcMethod( "login" )]
      //string login ( string user, string pass );

      #endregion

   }
}
